package dom.xpath.data;

import java.io.IOException;
import dom.xpath.io.PrintOutput;
import org.xml.sax.SAXException;

/**
 * This is an interface for query results.
 *
 * @author Workgroup DBIS, University of Konstanz 2005-07, ISC License
 * @author Christian Gruen
 */
public interface Result {
  /**
   * Number of values, stored in the result instance.
   * @return number of values
   */
  int size();

  /**
   * Compares values for equality.
   * @param v value to be compared
   * @return true if values are equal
   */
  boolean sameAs(Result v);

  /**
   * Serializes the stored data to the specified output stream.
   * @param out output stream
   * @param valid well-formed output
   * @throws IOException in case of problems with the PrintOutput
   */
  void serialize(PrintOutput out, boolean valid) throws IOException;

  /**
   * Serializes the stored data to the specified reader.
   * @param rr default handler
   * @throws SAXException in case of problems with the PrintOutput
   */
  void serialize(ResultReader rr) throws SAXException;
}
